<?php 
session_start();
if (isset($_POST['name']) && isset($_POST['fdes'])){
    $openid=trim(addslashes($_POST['fdes']));
	$name=trim(addslashes($_POST['name']));
	$phone=trim(addslashes($_POST['phone']));
	$hao=trim(addslashes($_POST['hao']));

	if (empty($name) || empty($phone) || empty($hao)){
	    echo json_encode(array('s'=>'not'));
	    exit;
	}
	include_once("../c/config.php");
	$mysqli = new mysqli($dbhost, $dbuser, $dbpwd, $dbName);
	if (!$mysqli->set_charset("utf8")) {printf("Error loading character set utf8: %s\n", $mysqliTwo->error);}
	$sql="select id from u3 where openid='".$openid."'  limit 0, 1";
	$query=$mysqli->query($sql);
    if($query->num_rows>0){
       
    }else{
        $mysqli->query("INSERT INTO `u3` (`openid`,`name`,`phone`,`hao`,`createtime`) VALUES ('".$openid."','".$name."','".$phone."','".$hao."','".date("Y-m-d H:i:s")."') ");
    }
    
    $msg=json_encode(array('s'=>'n'));
    $query=$mysqli->query("select id from ci3 where openid='".$openid."' limit 0, 1");
    if($query->num_rows>0){
        $msg=json_encode(array('s'=>'h'));
    }
    
    $endTime=strtotime("2020-09-23 19:59:58");
    $cha=$endTime - time();
    if ($cha > 0){
        $msg=json_encode(array('s'=>'time'));
    }
    echo $msg;
    $mysqli->close();

}else{
    $msg=json_encode(array('s'=>'n'));
}
?>